<template>
  <div>
    <input
      type="password"
      placeholder="密码"
      v-model="password"
      style="border-bottom:2px solid #eee;margin:61rpx 40rpx;"
    />
    <input
      type="password"
      placeholder="确认新密码"
      v-model="newpassword"
      style="border-bottom:2px solid #eee;margin:61rpx 40rpx;"
    />
    <button class="qs_btn" :disabled="disabled" @click="determine">确定</button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      password: "",
      newpassword: ""
    };
  },
  computed: {
    disabled() {
      if (
        this.password == this.newpassword &&
        this.password != "" &&
        this.newpassword != ""
      ) {
        return false;
      } else {
        return true;
      }
    }
  },
  onLoad() {
    this.getDatas();
  },
  methods: {
    getDatas() {
      (this.password = ""), (this.newpassword = "");
    },
    determine() {
      const passwords = wx.getStorageSync("loginInfo");
     const  phonenum= passwords.loginID;
        const  password= this.password;
         const password2= this.newpassword;
      wx.request({
        url: this.$interfaces.findPasswordSi+"/"+phonenum+"/"+password+"/"+password2,
        // data: {
        //   phonenum: password.loginID,
        //   password: this.password,
        //   password2: this.newpassword,
        // },
          method: "get",
           success: function(res) {
            if (res.statusCode == "200") {
              wx.clearStorage();
              wx.reLaunch({
                url: "../home/main"
              });
            }
          }
      });
      //  wx.switchTab({
      //     url: '/pages/myde/main'
      //   })
    }
  }
};
</script>
<style>
.qs_btn {
  margin: 0 40rpx;
  background: #0097fb;
  color: #fff;
}
</style>
